
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>
    <style>
        .layui-input{
            width: 200px;
        }
        .max{
            /*margin: auto;*/
            margin-top: 100px;
            width: 100px;
        }
        body{
            background-image: url("img/thumb-1920-26102.jpg");
            color: #7cbb9f;
        }

        fieldset{
            width: 400px;
            height: 380px;
            border: 1px solid #bfbfbf;
            position: absolute;
            top: 25%;
            left: 39%;
            border-radius: 20px;
            padding: 20px 40px 0 ;
            box-shadow: 0 0 60px 10px #360f0f;
            font-size: 15px;
            color: black;
        }
    </style>
</head>
<body>

<div style="margin: 70px 41% ;color: #fdfffd;font-size: 70px ">树哥书城</div>

<fieldset>
<div class="layui-form max"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="layui-form-item">
        <label class="layui-form-label" style="color: white ;font-size: 15px">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="color: white">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" id="pword" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <%--<button id="sub" class="layui-btn" lay-submit lay-filter="*"  style="color: #994a2b">登录</button>--%>
            <button type="button"  id="sub" lay-submit lay-filter="*" class="layui-btn layui-btn-warm layui-btn-radius ">&nbsp;&nbsp;&nbsp;&nbsp;登录&nbsp;&nbsp;&nbsp;&nbsp;</button>
        </div>
    </div>
    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</div>
</fieldset>
<div style="margin: 500px 34% 100px 36% ;color: #6b6b6d;font-size: 70px ">欢迎来到树哥书城</div>



<script>
    layui.use(['element','layer'], function(){
        var $ = layui.jquery,
            element = layui.element;
        var layer = layui.layer;
        $("#sub").click(function (){
            var username =  $("#username").val();
            var password =  $("#pword").val();
            $.post(
                "${pageContext.request.contextPath}/user/login",
                {username,password},
                function (bakedata){
                    if (bakedata.code==404){
                        layer.msg(bakedata.msg, {icon: 5});
                    }else{
                        layer.msg(bakedata.msg, {icon: 1});
                        //window.location.href = "homePage.jsp";
                        //表示登录成功，本来应该要直接跳转到管理系统首页，现在需要先去查询当前用户对应的权限
                        window.location.href = "menu/getAllMenuById";
                    }
                })
        })
    });


</script>
</body>
</html>
